package com.jxdinfo.hussar.example.mes.assess.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.jxdinfo.hussar.example.common.core.controller.BaseController;
import com.jxdinfo.hussar.example.common.core.domain.AjaxResult;
import com.jxdinfo.hussar.example.common.core.page.TableDataInfo;
import com.jxdinfo.hussar.example.common.utils.poi.ExcelUtil;
import com.jxdinfo.hussar.example.mes.assess.domain.MesAssessCostRecord;
import com.jxdinfo.hussar.example.mes.assess.service.IMesAssessCostRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 成本统计管理Controller
 *
 * @author ruoyi
 * @date 2024-04-16
 */
@RestController
@RequestMapping("/assess/assesscostrecord")
public class MesAssessCostRecordController extends BaseController

{
    @Autowired
    private IMesAssessCostRecordService mesAssessCostRecordService;

    /**
     * 查询成本统计管理列表
     */
//    @PreAuthorize("@ss.hasPermi('assess:assesscostrecord:list')")
    @GetMapping("/list")
    public TableDataInfo list(MesAssessCostRecord
                                          mesAssessCostRecord)
    {
        startPage();
        List<MesAssessCostRecord> list = mesAssessCostRecordService.selectMesAssessCostRecordList(mesAssessCostRecord);
        return getDataTable(list);
    }

    /**
     * 导出成本统计管理列表
     */
//    @PreAuthorize("@ss.hasPermi('assess:assesscostrecord:export')")
//    @Log(title = "成本统计管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, MesAssessCostRecord mesAssessCostRecord)
    {
        List<MesAssessCostRecord> list = mesAssessCostRecordService.selectMesAssessCostRecordList(mesAssessCostRecord);
        ExcelUtil<MesAssessCostRecord> util = new ExcelUtil<MesAssessCostRecord>(MesAssessCostRecord.class);
        util.exportExcel(response, list, "成本统计管理数据");
    }

    /**
     * 获取成本统计管理详细信息
     */
//    @PreAuthorize("@ss.hasPermi('assess:assesscostrecord:query')")
    @GetMapping(value = "/get/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(mesAssessCostRecordService.selectMesAssessCostRecordById(id));
    }

    /**
     * 新增成本统计管理
     */
//    @PreAuthorize("@ss.hasPermi('assess:assesscostrecord:add')")
//    @Log(title = "成本统计管理", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody MesAssessCostRecord mesAssessCostRecord)
    {
        return toAjax(mesAssessCostRecordService.insertMesAssessCostRecord(mesAssessCostRecord));
    }

    /**
     * 修改成本统计管理
     */
//    @PreAuthorize("@ss.hasPermi('assess:assesscostrecord:edit')")
//    @Log(title = "成本统计管理", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody MesAssessCostRecord mesAssessCostRecord)
    {
        return toAjax(mesAssessCostRecordService.updateMesAssessCostRecord(mesAssessCostRecord));
    }

    /**
     * 删除成本统计管理
     */
//    @PreAuthorize("@ss.hasPermi('assess:assesscostrecord:remove')")
//    @Log(title = "成本统计管理", businessType = BusinessType.DELETE)
	@GetMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(mesAssessCostRecordService.deleteMesAssessCostRecordByIds(ids));
    }
}
